<template>
	<view>
		<navbar title="回访记录" :isbg="false" :autoBack="true" :opacity='1'>
			<view class="add" slot='rightbtn' @click="navto('/pages/datagl/addhf?id='+id)">
				添加
			</view>
		</navbar>
		<view class="con">
			<scroll-view scroll-y="true" class="scbox1">
				<view class="box" v-if="list.length>0">
					<view class="box__item" v-for="(item,index) in list" :key="index">
						<view class="u-flex u-flex-y-center u-flex-between" style="margin-bottom: 27rpx;">
							<view class="box__item__name">
								内容:{{item.content}}
							</view>
						</view>
						<view class="u-flex u-flex-y-center u-flex-between">
							<view class="box__item__time">
								日期:{{$u.timeFormat(item.createtime, 'yyyy-mm-dd hh:MM:ss')}}
							</view>
							<view class="box__item__text" v-if="item.userInfo">
								回访人: <text style="28rpx">{{item.userInfo.username}}</text>
							</view>
						</view>
					</view>
				</view>
				<u-empty mode="list" v-else text="记录为空"></u-empty>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import datagl from '@/api/_datagl.js'
	export default {
		data() {
			return {
				keyword: '',
				list: [],
				id: ''
			};
		},
		methods: {
			async getlist() {
				let res = await datagl.getVisitList({
					customer_id: this.id
				})
				if (res.data.code == 1) {
					this.list = res.data.data
					uni.stopPullDownRefresh()
				}
			}
		},
		onLoad(o) {
			this.id = o.id
			this.getlist()
		},
		onPullDownRefresh() {
			this.getlist()
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F8F8F8;
	}

	.add {
		font-family: PingFang-SC, PingFang-SC;
		font-weight: bold;
		font-size: 30rpx;
		color: #2A51FA;
		line-height: 30rpx;
	}

	.con {
		padding: 30rpx;

		.box {
			background: #FFFFFF;
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			padding: 0 6rpx 0 26rpx;

			&__item {
				padding: 40rpx 22rpx 34rpx 4rpx;
				border-bottom: 2rpx solid #F9F9F9;

				&__name {
					font-family: PingFang-SC, PingFang-SC;
					font-weight: bold;
					font-size: 30rpx;
					color: #010101;
					line-height: 30rpx;
				}

				&__more {
					width: 21rpx;
					height: 31rpx;
				}

				&__time {
					font-family: PingFang-SC, PingFang-SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #6D6D6D;
					line-height: 24rpx;
				}

				&__text {
					font-family: PingFang-SC, PingFang-SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #6D6D6D;
					line-height: 24rpx;
					color: #F85B05;
				}

				&__num {
					color: #2A51FA;
					font-size: 28rpx;
				}
			}
		}
	}

	.scbox1 {
		height: calc(100vh - var(--status-bar-height) - 44px - 60rpx);
	}
</style>